package com.scuec.groupfive.entity;

import lombok.Data;
import java.util.Date;

@Data
public class AdminWrongQuestionOverview {
    private Long wrongId;
    private String subjectName;
    private String chapterName;
    private String pointNames;
    private String examTypeName;
    private String content;  // 原始内容
    private Integer wrongCount;
    private Date lastWrongTime;

    // 新增概览内容字段，限制长度
    private String previewContent;

    // 设置内容时自动生成预览内容
    public void setContent(String content) {
        this.content = content;
        this.previewContent = generatePreview(content);
    }

    // 生成预览内容，限制为25个字符
    private String generatePreview(String content) {
        if (content == null) return "";

        // 限制长度
        int maxLength = 25;
        if (content.length() <= maxLength) {
            return content;
        }

        // 截取内容并添加省略号
        return content.substring(0, maxLength) + "...";
    }
}